const Login = () => import('@/views/Login.vue')

const Home = () => import('@/views/Home.vue')
const Account = () => import('@/views/Account.vue')
const User = () => import('@/views/admin/User.vue')
const Role = () => import('@/views/admin/Role.vue')
const Vote = () => import('@/views/vote/Vote.vue')
const Ballot = () => import('@/views/vote/Ballot.vue')

import NotFound from './views/404.vue'
import Main from './views/Main.vue'
// 追加route，需要在service/config/config.js添加对应的权限
const routes = [
  {
    path: '/login',
    component: Login,
    name: '',
    hidden: true
  },
  {
    path: '/404',
    component: NotFound,
    name: '',
    hidden: true
  },
  {
    path: '/',
    component: Home,
    name: '管理面板',
    label: '管理面板',
    iconCls: 'fa fa-cog', // 图标样式class，fa或者el-icon都行
    meta: { title: '管理面板' },
    children: [
      {
        path: '/main',
        component: Main,
        name: 'main',
        label: '主页',
        hidden: true,
        meta: { title: '主页' }
      },
      {
        path: '/account',
        component: Account,
        name: 'account',
        label: '设置',
        hidden: true,
        meta: { title: '设置' }
      },
      {
        path: '/user',
        component: User,
        name: 'user',
        label: '用户',
        meta: { title: '用户' }
      },
      {
        path: '/role',
        component: Role,
        name: 'role',
        label: '角色',
        meta: { title: '角色' }
      }
    ]
  },
  {
    path: '/',
    component: Home,
    name: '投票管理',
    label: '投票管理',
    iconCls: 'fa fa-users',
    meta: { title: '投票管理' },
    children: [
      {
        path: '/vote',
        component: Vote,
        name: 'vote',
        label: '投票',
        meta: { title: '投票' }
      },
      {
        path: '/ballot',
        component: Ballot,
        name: 'ballot',
        label: '选票',
        meta: { title: '选票' }
      }
    ]
  },
  {
    path: '*',
    hidden: true,
    redirect: {
      path: '/404'
    }
  }
]

export default routes
